
package main

import (
	"fmt"
	"reflect"
)

type Event struct {
	Topic string
	Data  string
}

type Logs struct {
	Addr   string
	Hash   string
	Height uint64
	Events []Event
}

func main() {
	u := Logs{
		Addr:   "qwrtyuiopasdfghjkl",
		Hash:   "zxcvbnm",
		Height: 1011,
		Events: []Event{{Topic: "123456789", Data: "987654321"}, {Topic: "zz123456789", Data: "zz987654321"}},
	}
	t := reflect.TypeOf(u)
	v := reflect.ValueOf(u)
	for k := 0; k < t.NumField(); k++ {
		fmt.Printf("%s -- %v \n", t.Field(k).Name, v.Field(k).Interface())
		if v.Field(k).Kind() == reflect.Slice {
			t2 := v.Field(k).Type()
			v2 := v.Field(k)
			fmt.Println(t2.String() + " --")
			for i := 0; i < v2.Len(); i++ {
				v3 := v2.Index(i)
				fmt.Println(111, v3)
				for j := 0; j < v3.NumField(); j++ {
					fmt.Printf("%s -- %v \n", v3.Type().Field(j).Name, v3.Field(j).Interface())
				}
			}
		}
	}
}